const { pageUrl } = require('./axios')

module.exports = {
    //例子  获取轮播图
    geiImg() {
        return pageUrl('banner/list', 'GET', { type: 'index' })
    },
    // 九宫格
    getList() {
        return pageUrl('shop/goods/category/all', 'GET', {})
    },
    // 商品列表
    getData() {
        return pageUrl('shop/goods/list', 'POST', {})
    },
    // 查询用户资产 tyw
    getUser(token) {
        return pageUrl('user/amount', 'POST', { token})
    },
    // 用户信息
    getUser_admin(token) {
        return pageUrl('user/detail', 'POST', { token})
    },
    // 获取订单
    getDD(val,token) {
        return pageUrl('order/list', 'POST', { token, status: val || '' })
    },
    // 砍价
    getKanjia() {
        return pageUrl('shop/goods/list', 'POST', { kanjia: "true" })
    },
    // 秒杀
    getmiaosha() {
        return pageUrl('shop/goods/list', 'POST', { miaosha: "true" })
    },
    recommendStatus() {
        return pageUrl('shop/goods/list', 'POST', { recommendStatus: "1" })
    },
    // 拼团
    pintuan() {
        return pageUrl('shop/goods/list', 'POST', { pingtuan: "true" })
    },
    getGwc(goodsId, num = 1, sku = [{}],token) {
        return pageUrl('shopping-cart/add', 'POST', { goodsId: goodsId, token, number: num, sku })
    },
    getGwcs(token,goodsId, num = 1) {
        console.log(token);
        return pageUrl('shopping-cart/add', 'POST', { goodsId: goodsId, token, number: num })
    },
    ly_xq(id,token) {
        return pageUrl('shop/goods/detail', 'GET', { id: id, token })
    },
    upnubmer(key, number,token) {
        return pageUrl('shopping-cart/modifyNumber', 'POST', { token, key: key, number: number })
    },
    getCart(token) {
        return pageUrl('shopping-cart/info', 'GET', { token })
    },
    getCartDel(key,token) {
        return pageUrl('shopping-cart/remove', 'POST', { token, key: key })
    },

    input(key, selected,token) {
        return pageUrl('shopping-cart/select', 'POST', { token, key: key, selected: selected })
    },
    // 三级分销
    getDistributor(token) {
        return pageUrl('saleDistribution/setting', 'GET', { token })
    },
    // 申请成为分销商
    getApply(user, tel,token) {
        return pageUrl('saleDistribution/apply', 'POST', { token, name: user, mobile: tel })
    },
    getOrderBy(val = {},token) {
        return pageUrl('shop/goods/list', 'POST', { token, orderBy: val })
    },
    // 添加收藏
    getfav(id,token) {
        return pageUrl('shop/goods/fav/add', 'POST', { goodsId: id, token, type: 0 })
    },
    // 查看手收藏
    getcheck(id,token) {
        return pageUrl('shop/goods/fav/check', 'GET', { goodsId: id, token, type: 0 })
    },
    // 删除收藏
    delfav(id,token){
        return pageUrl('shop/goods/fav/delete', 'POST', { goodsId: id, token, type: 0 })
    },
    getGoodsList: (params = {}) => {
        return pageUrl('shop/goods/list', 'POST', params, true)
    },
    // 积分券兑换积分
    getscore(token,number){
        return pageUrl('score/exchange', 'POST', {token,number})
    },
    exchange(token,deductionScore){
        return pageUrl('growth/exchange', 'POST', {token,deductionScore})
    },
    // 收藏列表
    favlist(token){
        return pageUrl('shop/goods/brand/fav/list', 'POST', {token})
    },
    
    // 添加收货地址
    addaddress(token,obj){
        return pageUrl('user/shipping-address/add', 'POST', {token,address:obj.address,cityId:obj.cityId,linkMan:obj.linkMan,mobile:obj.mobile,provinceId:obj.provinceId,districtId:obj.districtId})
    },
//    请求收货地址列表
getaddress(token){
    return pageUrl('user/shipping-address/list', 'GET', {token})
},
// 收货地址详情
    getxq(token,id){
        return pageUrl('user/shipping-address/detail/v2', 'GET', {token,id})
    },
    // 删除收货地址
    removeadd(token,id){
        return pageUrl('user/shipping-address/delete', 'POST', {token,id})
    },
    // 修改收货地址
    updataaddress(token,obj,id){
        return pageUrl('user/shipping-address/update', 'POST', {token,address:obj.address,cityId:obj.cityId,linkMan:obj.linkMan,mobile:obj.mobile,provinceId:obj.provinceId,districtId:obj.districtId,id})
    },
}
